package com.atguigu01._static;

/**
 * ClassName: ChineseTest
 * Package: com.atguigu01._static
 * Description:
 *
 * @Author 姜
 * @Create 2023/11/22 19:09
 * @Version 1.0
 */
public class ChineseTest {
    public static void main(String[] args) {
        Chinese.show();
        Chinese c1 = new Chinese();
        c1.name = "坤坤";
        c1.age = 25;
        c1.nation = "中国";

        Chinese c2 = new Chinese();
        c2.name = "法师";
        c2.age = 30;


        System.out.println(c1.nation);
        System.out.println(c2.nation);

        c2.nation = "CHN";
        System.out.println(c1.nation);
        System.out.println(c2.nation);
    }
}

class Chinese {
    // 肺静态变量、实例变量
    String name;
    int age;
    // 静态变量、类变量
    static String nation;

    @Override
    public String toString() {
        return "Chinese{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public static void show() {
        System.out.println("干饭人，干饭魂。");
        System.out.println(nation);
        method1();

    }

    public void eat(String food) {
        System.out.println("吃" + food);
    }

    public static void method1() {
        System.out.println("静态测试方法");
    }
    public void method2(){
        this.eat("红烧肘子");

    }
}
